package bdz.projects.inl.vo
{
	import bdz.projects.inl.core.CoreVO;

	public class ProjectVO extends CoreVO
	{
		public var project_id:String;
		public var project_title:String;
		public var project_location:String;
		public var project_date:Date;
		public var project_hero_image:String;
		public var project_hero_thumb:String;
		public var project_products_text:String;
		
		public var products:Array = new Array();
		public var credits:Array = new Array();
		public var categories:Array = new Array();
		
		public function ProjectVO(def:XML = null)
		{
			idField = "project_id";
			linkPairs = [
						{tree:"products", node:"inl_products", arr:"products", vo:ProductVO},
						{tree:"project_credits", node:"inl_project_credits", arr:"credits", vo:ProjectCreditVO},
						{tree:"project_categories", node:"inl_project_categories", arr:"categories", vo:ProjectCategoryVO}
						];
			if(def && def.name() != "inl_projects"){
				def = def.inl_projects[0];	
			}
			propList = ["project_id", "project_title", "project_location", "project_date", "project_hero_image", "project_hero_thumb", "project_products_text"];
			super(def, ProjectMediaVO, "inl_projects");
		}
		override protected function createPropertyAttributes():void{
			propAttributes = [
			{name:"project_title", type:"input", label:"Title"},
			{name:"project_location", type:"input", label:"Location"},
			{name:"project_date", type:"date", label:"Date"},
			{name:"project_hero_image", type:"image", label:"Hero Image"},
			{name:"project_hero_thumb", type:"image", label:"Hero Thumbnail"},
			{name:"project_products_text", type:"input", label:"Related Products (Old)"},
			{name:"relations", type:"dependency_list", vo:ProjectMediaVO, label:"Media", list:"media", labelField:"media_link", idField:"project_media_id"},
			{name:"categories", type:"dependency_list", vo:ProjectCategoryVO, label:"Categories", list:"lookup", labelField:"project_category_name", idField:"project_category_id"},
			{name:"credits", type:"dependency_list", vo:ProjectCreditVO, label:"Credits", list:"lookup", labelField:"project_credit_name", idField:"project_credit_id"},
			{name:"products", type:"dependency_list", vo:ProductVO, label:"Products", list:"link", labelField:"product_name", idField:"project_id"}
			];
		}
		
	}
}